import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.stream.Stream;

/**
 * Stream流的获取
 */
public class GetStreamDemo {
    public static void main(String[] args) {
        // 单列集合
        ArrayList<String> list1 = new ArrayList<>(Arrays.asList("张三丰", "张无忌", "张翠山", "王二麻子", "张良", "谢广坤"));
        list1.stream().filter(s -> s.startsWith("张"))
                .filter(s -> s.length() == 3)
                .forEach(System.out::println);

        // 双列集合
        HashMap<String, Integer> map = new HashMap<>();
        map.put("zhangsan",23);
        map.put("lisi",24);
        map.put("wangwu",25);
        map.put("zhaoliu",26);
        map.put("qianqi",27);
        map.keySet().stream().forEach(System.out::println);
        map.entrySet().stream().forEach(System.out::println);

        // 数组
        int[] arr = {1,2,3,4,5};
        Arrays.stream(arr).forEach(System.out::println);

        // 同种数据类型的多个数据
        Stream.of(1,2,3,4,5,6,7,8).forEach(System.out::println);
    }
}
